<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <style type="text/css">
        canvas{
            border: 1px solid red;
        }
    </style>
</head>
<body>
<canvas id="box" width="1800" height="1800"></canvas>
<script type="text/javascript">
    var box=document.getElementById("box");
    var pen=box.getContext("2d");

     pen.clearRect(0,0,box.width,box.height);//清除画布
     pen.rect(100,100,100,100);
     pen.scale(3,3);
     pen.rect(100,100,100,100);
     pen.stroke();

     pen.beginPath();
     pen.arc(300,300,50,0,Math.PI/2,true);
     pen.closePath();
     pen.stroke();


    </script>
</body>
</html>